package com.cxhc.cockpit;


import com.cxhc.common.annotation.Anonymous;
import com.cxhc.common.core.domain.R;
import com.cxhc.system.domain.app.HomeApp;
import com.cxhc.system.domain.app.WeatherApp;
import com.cxhc.system.service.app.IHomeAppService;
import com.cxhc.system.service.app.IWeatherService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 首页模块接口
 */
@RestController()
@RequestMapping("/cockpit/weather")
@ApiOperation("/cockpit/weather")
@CrossOrigin(origins = "*", maxAge = 3600)
public class ApiWeather {


    @Resource
    private IWeatherService weatherService;

    /**
     * 获取当天天气
     *
     * @return
     */
    @Anonymous
    @RequestMapping("/getTodayWeather")
    @ApiOperation("/getTodayWeather")
    private R<WeatherApp> getTodayWeather(String city) {
        return R.ok(weatherService.getWeather(city));
    }
}
